<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <collapse></collapse>
        <collapse></collapse>
        <collapse></collapse>
    </div>
    <script src="./vue.js"></script>

    <script id="collapse" type="text/x-template">
        <div class="collapse">
            <div class="main" @click="toggle">{{main}}</div>
            <div class="child" v-show="isShow">{{child}}</div>
        </div>
    </script>

    <script>
        let vm = new Vue({
            el:'#app',
            components:{
                'collapse':{
                    template:'#collapse',
                    data(){
                        return {
                            isShow:false,
                            main:'主面板',
                            child:"子面板"
                        }
                    },
                    methods: {
                        toggle(){
                            this.isShow = !this.isShow
                        }
                    }
                }
            }
        })
    </script>
</body>
</html>